/*
 * Copyright 2011-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0.
 * See `LICENSE` in the project root for license information.
 */

package me.ijleex.platform.system.admin.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import me.ijleex.platform.framework.util.snowflake.IdWorker;
import me.ijleex.platform.system.admin.entity.Admin;
import me.ijleex.platform.system.admin.mapper.AdminMapper;
import me.ijleex.platform.system.admin.service.IAdminService;

/**
 * 管理员 服务层实现
 *
 * @author liym
 * @since 2019-03-14 11:03:53 By 'codegen'
 */
@Service
public class AdminServiceImpl implements IAdminService {

    private final AdminMapper mapper;

    public AdminServiceImpl(AdminMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public int insertAdmin(Admin o) {
        long id = IdWorker.getId();
        o.setId(id);
        return this.mapper.insert(o);
    }

    @Override
    public int deleteAdminByIds(String ids) {
        return this.mapper.delete(ids);
    }

    @Override
    public int updateAdmin(Admin o) {
        return this.mapper.update(o);
    }

    @Override
    public List<Admin> getAdminList(Admin o) {
        return this.mapper.selectList(o);
    }

    @Override
    public Admin getAdminById(Long id) {
        return this.mapper.selectById(id);
    }

}
